package org.example.route.event.publisher;

import org.example.route.event.OrderCancelEvent;
import org.example.route.event.OrderPayEvent;
import org.example.route.event.source.OrderCancelSource;
import org.example.route.event.source.OrderPaySource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;

/**
 *
 * 订票生产者
 *
 * **/
@Service
public class OrderPublisher {

    @Autowired
    private ApplicationEventPublisher applicationEventPublisher;

    //发送取消订单事件
    public void publishCancelEvent(OrderCancelSource orderCancelSource)
    {
        OrderCancelEvent event = new OrderCancelEvent(this,orderCancelSource);
        applicationEventPublisher.publishEvent(event);
    }

    //发送订单支付事件

    public void publishPayEvent(OrderPaySource orderPaySource)
    {
        OrderPayEvent event = new OrderPayEvent(this,orderPaySource);
        applicationEventPublisher.publishEvent(event);
    }



}
